<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SHOP 管理中心 - 属性管理 </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="{$Think.const.ADMIN_CSS_PATH}general.css" rel="stylesheet" type="text/css" />
<link href="{$Think.const.ADMIN_CSS_PATH}main.css" rel="stylesheet" type="text/css" />
</head>
<body>

<h1>
<span class="action-span"><a href="__MODULE__/Attribute/attribute_add">添加属性</a></span>
<span class="action-span1"><a href="index.php?act=main">SHOP 管理中心</a> </span><span id="search_id" class="action-span1"> - 商品属性 </span>
<div style="clear:both"></div>
</h1>

<div class="form-div">
  <form action="" name="searchForm">
    <img src="{$Think.const.ADMIN_IMG_PATH}icon_search.gif" width="26" height="22" border="0" alt="SEARCH">
    按商品类型显示：<select name="goods_type" onchange="searchAttr(this.value);">
    <option value="0">所有商品类型</option>
    <?php foreach($types as $type):?>
    <option value="<?php echo $type['type_id'];?>" <?php if($_GET['type_id']==$type['type_id']) echo "selected=selected";?>><?php echo $type['type_name'];?></option>
    <?php endforeach;?>
  </select>
  </form>
</div>

<form method="post" action="attribute.php?act=batch" name="listForm">
<div class="list-div" id="listDiv">

  <table cellpadding="3" cellspacing="1">
    <tbody>
		<tr>
			<th><input onclick="listTable.selectAll(this, &quot;checkboxes[]&quot;)" type="checkbox">编号 </th>
			<th>属性名称</th>
			<th>商品类型</th>
			<th>属性值的录入方式</th>
			<th>可选值列表</th>
			<th>排序</a></th>
			<th>操作</th>
		</tr>

<?php foreach($list as $ls):?>
        <tr>
			<td nowrap="true" valign="top"><span><input value="1" name="checkboxes[]" type="checkbox"><?php echo $ls[attr_id];?></span></td>
			<td class="first-cell" nowrap="true" valign="top"><span onclick="listTable.edit(this, 'edit_attr_name', 1)"><?php echo $ls[attr_name];?></span></td>
			<td nowrap="true" valign="top"><span><?php echo $ls[type_name];?></span></td>
			<td nowrap="true" valign="top"><span><?php 

            switch ($ls['attr_input_type']) {
              case '0':
                  echo '手工录入';
                break;
              case '1':
                  echo '下拉列表';
                break;              
               case '2':
                  echo '多行文本';
                break;          
            }  ?>
      </span></td>
			<td valign="top"><span></span></td>
			<td align="right" nowrap="true" valign="top"><span onclick="listTable.edit(this, 'edit_sort_order', 1)"><?php echo $ls['sort_order'];?></span></td>
			<td align="center" nowrap="true" valign="top">
				<a href="__CONTROLLER__/attr_delete/attr_id/<?php echo $ls['attr_id'];?>" title="编辑"><img src="{$Think.const.ADMIN_IMG_PATH}icon_edit.gif" border="0" height="16" width="16"></a>
				<a href="__CONTROLLER__/attribute_delete/attr_id/<?php echo $ls['attr_id'];?>" name="yc" title="移除"><img src="{$Think.const.ADMIN_IMG_PATH}icon_drop.gif" border="0" height="16" width="16"></a>
			</td>
		</tr>
<?php endforeach;?>

      </tbody></table>

  <table cellpadding="4" cellspacing="0">
    <tbody><tr>
      <td style="background-color: rgb(255, 255, 255);"><input type="submit" id="btnSubmit" value="删除" class="button" disabled="true"></td>
      <td align="right" style="background-color: rgb(255, 255, 255);">      <!-- $Id: page.htm 14216 2008-03-10 02:27:21Z testyang $ -->
    <!--         <div id="turn-page">
            总计  <span id="totalRecords">12</span>
            个记录分为 <span id="totalPages">2</span>
            页当前第 <span id="pageCurrent">1</span>
            页，每页 <input type="text" size="3" id="pageSize" value="10" onkeypress="return listTable.changePageSize(event)">
            <span id="page-link">
              <a href="javascript:listTable.gotoPageFirst()">第一页</a>
              <a href="javascript:listTable.gotoPagePrev()">上一页</a>
              <a href="javascript:listTable.gotoPageNext()">下一页</a>
              <a href="javascript:listTable.gotoPageLast()">最末页</a>
              <select id="gotoPage" onchange="listTable.gotoPage(this.value)">
    <option value="1">1</option><option value="2">2</option>          </select>
            </span>
          </div> -->{$page}
</td>
    </tr>
  </tbody></table>
</div>

</form>

<div id="footer">
	版权所有 &copy; 2012-2013 传智播客 - PHP培训 - </div>
</div>

</body>
</html>
<script type="text/javascript">
  
          function searchAttr(val)
          {
            var  url = 'http://22.com/Admin/Attribute/attribute_list/type_id/'+val;

            window.location.href = url ;

          }
</script>

<script type="text/javascript">
    
   var yc = document.getElementsByName('yc');

        for(var i=0;i<yc.length;i++)
        {
            yc[i].onclick = function()
            {
               var url = this.href;
                this.href = '';
               if (confirm('确定要删除么'))
               {
                  var xhr = new XMLHttpRequest();

                  xhr.onreadystatechange = function()
                  {
                      if (this.readyState == 4) 
                        {
                          alert(this.responseText);
                        }
                  }
                  xhr.open('get',url,false);
        
                  xhr.send(null);
                  }
               else
               {
                  return false;
               }
            }
        }
</script>